| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Node.h
1 // Node.h
3 //
5
6 namespace nkExport
7 {
11 enum class NODE_VALUE_TYPE
12 {
13 NOT_VALUE_TYPE,
14 BOOL_TYPE,
15 STRING_TYPE,
16 INT_TYPE,
17 UINT_TYPE,
18 LONG_TYPE,
19 ULONG_TYPE,
20 FLOAT_TYPE,
21 DOUBLE_TYPE
22 } ;
23
27 enum class NODE_NATURE
28 {
29 EMPTY_NATURE = 0,
30 VALUE_NATURE,
31 OBJECT_NATURE,
32 ARRAY_NATURE
33 } ;
34 }
35
36 namespace nkExport
37 {
41 class Node final
42 {
43 public :
44
45 // Destructor
49 virtual ~Node () ;
50
51 // Getters
52 // Globals
56 NODE_NATURE getNodeNature () const ;
60 NODE_VALUE_TYPE getNodeValueType () const ;
61 // Utils
65 bool isValueTypeNumber () const ;
71 bool hasChild (nkMemory::StringView key, NODE_VALUE_TYPE valueType) ;
77 bool hasChild (nkMemory::StringView key, NODE_NATURE nature) ;
78 // Value
84 nkMemory::StringView getValueAsString () const ;
90 int getValueAsInt () const ;
96 unsigned int getValueAsUint () const ;
102 long long getValueAsLong () const ;
108 unsigned long long getValueAsUlong () const ;
114 float getValueAsFloat () const ;
120 double getValueAsDouble () const ;
126 bool getValueAsBool () const ;
127 // Object
131 unsigned int getMemberCount () const ;
139 nkMemory::StringView getMemberKey (unsigned int index) const ;
146 Node* getMemberValue (unsigned int index) const ;
157 Node* getMemberValue (nkMemory::StringView key) const ;
169 Node* getMemberValue (nkMemory::StringView key, NODE_VALUE_TYPE valueType) const ;
181 Node* getMemberValue (nkMemory::StringView key, NODE_NATURE nodeNature) const ;
185 unsigned int getArraySize () const ;
190 Node* getArrayElement (unsigned int index) const ;
196 Node* getArrayElement (unsigned int index, NODE_VALUE_TYPE valueType) const ;
202 Node* getArrayElement (unsigned int index, NODE_NATURE nodeNature) const ;
206 void* getUserData () const ;
207
208 // Setters
214 void setAsString (nkMemory::StringView value) ;
220 void setAsInt (int value) ;
226 void setAsUint (unsigned int value) ;
232 void setAsLong (long long value) ;
238 void setAsUlong (unsigned long long value) ;
244 void setAsFloat (float value) ;
250 void setAsDouble (double value) ;
256 void setAsBool (bool value) ;
265 Node* addMember (nkMemory::StringView key) ;
273 void deleteMember (nkMemory::StringView key) ;
281 Node* addElement () ;
288 void setUserData (void* value) ;
289
290 // Operators
296 Node& operator= (const Node&) noexcept ;
302 Node& operator= (Node&&) noexcept ;
303
304 public :
305
306 // Statics
312 static nkMemory::UniquePtr<Node> create () noexcept ;
319 static nkMemory::UniquePtr<Node> create (const Node& other) noexcept ;
326 static nkMemory::UniquePtr<Node> create (Node&& other) noexcept ;
327 } ;
328 }
nkExport::Node::getArrayElement
Node * getArrayElement(unsigned int index, NODE_NATURE nodeNature) const
nkExport::NODE_VALUE_TYPE::NOT_VALUE_TYPE
@ NOT_VALUE_TYPE
A node which is an object or an array will have no value attached. In such case, this value is return...
nkExport::NODE_VALUE_TYPE::FLOAT_TYPE
@ FLOAT_TYPE
A node holding a float.
nkExport::Node::getValueAsUint
unsigned int getValueAsUint() const
nkExport::Node::getArrayElement
Node * getArrayElement(unsigned int index) const
nkExport::Node::getMemberValue
Node * getMemberValue(unsigned int index) const
nkExport::Node::getMemberValue
Node * getMemberValue(nkMemory::StringView key, NODE_VALUE_TYPE valueType) const
nkExport::Node::hasChild
bool hasChild(nkMemory::StringView key, NODE_NATURE nature)
nkExport::Node::setAsFloat
void setAsFloat(float value)
nkExport::NODE_VALUE_TYPE::DOUBLE_TYPE
@ DOUBLE_TYPE
A node holding a double.
nkExport::Node::create
static nkMemory::UniquePtr< Node > create() noexcept
nkExport::Node::operator=
Node & operator=(const Node &) noexcept
nkExport::Node::setAsBool
void setAsBool(bool value)
nkExport::Node::getMemberValue
Node * getMemberValue(nkMemory::StringView key) const
nkExport::NODE_VALUE_TYPE::ULONG_TYPE
@ ULONG_TYPE
A node holding an unsigned long (8 bytes).
nkExport::Node::getValueAsFloat
float getValueAsFloat() const
nkExport::NODE_NATURE::OBJECT_NATURE
@ OBJECT_NATURE
Represents a node holding references to other nodes, via the named member accessors.
nkExport::Node::setAsUint
void setAsUint(unsigned int value)
nkExport
Encompasses all API of component NilkinsExport.
Definition: Base64Encoder.h:7
nkExport::Node::addElement
Node * addElement()
nkExport::Node::~Node
virtual ~Node()
nkExport::NODE_NATURE::EMPTY_NATURE
@ EMPTY_NATURE
Represents an empty node.
nkExport::Node::isValueTypeNumber
bool isValueTypeNumber() const
nkExport::Node::getMemberCount
unsigned int getMemberCount() const
nkExport::Node::getValueAsBool
bool getValueAsBool() const
nkExport::Node::getValueAsDouble
double getValueAsDouble() const
nkExport::Node::getUserData
void * getUserData() const
nkExport::Node::getArrayElement
Node * getArrayElement(unsigned int index, NODE_VALUE_TYPE valueType) const
nkExport::NODE_VALUE_TYPE::UINT_TYPE
@ UINT_TYPE
A node holding an unsigned integer.
nkExport::Node::setAsLong
void setAsLong(long long value)
nkExport::Node::setAsString
void setAsString(nkMemory::StringView value)
nkExport::Node::getMemberKey
nkMemory::StringView getMemberKey(unsigned int index) const
nkExport::NODE_VALUE_TYPE
NODE_VALUE_TYPE
Describes the kind of value a node holds.
Definition: Node.h:12
nkExport::Node
A node in the tree structure representing the data to export / import.
Definition: Node.h:42
nkExport::Node::getValueAsLong
long long getValueAsLong() const
nkExport::Node::getNodeNature
NODE_NATURE getNodeNature() const
nkExport::NODE_NATURE::ARRAY_NATURE
@ ARRAY_NATURE
Represents a node holding references to other nodes, via the indexed array accessors.
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkExport::Node::hasChild
bool hasChild(nkMemory::StringView key, NODE_VALUE_TYPE valueType)
nkExport::Node::getValueAsString
nkMemory::StringView getValueAsString() const
nkExport::Node::getValueAsUlong
unsigned long long getValueAsUlong() const
nkExport::Node::setAsDouble
void setAsDouble(double value)
nkExport::NODE_VALUE_TYPE::INT_TYPE
@ INT_TYPE
A node holding an integer.
nkExport::NODE_NATURE
NODE_NATURE
Describes the nature of a node.
Definition: Node.h:28
nkExport::Node::setAsInt
void setAsInt(int value)
nkExport::Node::getNodeValueType
NODE_VALUE_TYPE getNodeValueType() const
nkExport::Node::getMemberValue
Node * getMemberValue(nkMemory::StringView key, NODE_NATURE nodeNature) const
nkExport::Node::addMember
Node * addMember(nkMemory::StringView key)
nkExport::NODE_VALUE_TYPE::LONG_TYPE
@ LONG_TYPE
A node holding a long (8 bytes).
nkExport::Node::deleteMember
void deleteMember(nkMemory::StringView key)
nkExport::NODE_NATURE::VALUE_NATURE
@ VALUE_NATURE
Represents a leaf node, holding a final value being either a bool, string, int, uint,...
nkExport::Node::getValueAsInt
int getValueAsInt() const
nkExport::NODE_VALUE_TYPE::STRING_TYPE
@ STRING_TYPE
A node holding a string.
nkExport::Node::setAsUlong
void setAsUlong(unsigned long long value)
nkExport::Node::setUserData
void setUserData(void *value)
nkExport::Node::getArraySize
unsigned int getArraySize() const
nkExport::NODE_VALUE_TYPE::BOOL_TYPE
@ BOOL_TYPE
A node holding a boolean.
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7